<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" >
		
	<h:form id="frm3">	
		<p:growl id="msgs3" showDetail="true" />
		<p:panel id="prodPanel" header="【第三步】采购清单信息" style="margin-bottom:5px" toggleable="true" >

			<h:panelGrid columns="1" cellspacing="10">			
				<p:commandButton value="生成采购清单" icon="ui-icon-plus" 
	           		process="@this" update=":frm3"
                 	actionListener="#{contractMB.onGenPurch}" >	

					<p:confirm header="确认" message="生成采购清单,原有清单数据会被清除，你确定？" icon="ui-icon-alert" />
				</p:commandButton>	
			</h:panelGrid>

			<p:dataTable id="pdt" value="#{contractMB.voppm}"  var="row"  rowIndexVar="rowNum"
				resizableColumns="true" liveResize="true" 
				editable="true"  style="margin-bottom:5px"
				paginator="true" paginatorPosition="bottom" rows="8" 
                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                rowsPerPageTemplate="5,10,15"  emptyMessage="没有记录" >
				
				<f:facet name="header">
			        采购清单信息
			    </f:facet>
    
				<p:ajax event="rowEdit" listener="#{contractMB.onPurchRowEdit}"
					update=":frm3:msgs3 :frm3:pdt" />
				<p:ajax event="rowEditCancel"	listener="#{contractMB.onRowCancel}"
					update=":frm3:msgs3" />
				<p:column headerText="No." style="width:5%">
					#{rowNum+1}
				</p:column>
				<p:column headerText="物料编号" sortBy="#{row.bmeMaterial.id}">
					<h:outputText value="#{row.bmeMaterial.id}" />
				</p:column>
				<p:column headerText="物料描述">
					<h:outputText value="#{row.bmeMaterial.mdesc}" />
				</p:column>
				<p:column headerText="规格">
					<h:outputText value="#{row.bmeMaterial.mmodel}" />
				</p:column>				
				<p:column headerText="数量">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.quantity}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.quantity}" style="width:100%"
								label="数量" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="单价">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.price}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.price}" style="width:100%"
								label="单价" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="金额">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.amount}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.amount}" style="width:100%"
								label="金额" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="加工规格">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.speci}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.speci}" style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="数量-片">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.processQuantity}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.processQuantity}" style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="加工工艺">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.processTeck}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.processTeck}" style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				
				<p:column headerText="安装区域">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.area}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.area}" style="width:100%"
								label="安装区域" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="备注">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.remarks}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.remarks}" style="width:100%"
								label="备注" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column style="width:32px">
					<p:rowEditor />
				</p:column>
			</p:dataTable>
		    
		</p:panel>
		
	</h:form>
				
</ui:composition>
